/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

#ifndef __PQ_InputOpTranslator_H__
#define __PQ_InputOpTranslator_H__

#include "BuilderPrerequisites.h"

#include "InputCode.h"
#include "ShortcutManager.h"

namespace PQBuilder
{
	/*Translate Input to operation and route the operation to specified module
	*/
	class InputOpTranslator
	{
	public:
		InputOpTranslator();
		~InputOpTranslator();
		
		inline static bool isCameraOp(OpType op)
		{
			if(op==OP_CAMERA_ROTATE
			||op==OP_SCALE_SCENE
			||op==OP_CAMERA_PAN){
				return true;
			}else{
				return false;
			}
		}
		
		inline bool isPressed(int type)
		{
			return _inputPressed[type];
		}

		/*Get possible operation from shortcut type
		*/
		OpType getOp(ShortcutType type);

	private:
		OpType getOp(ShortcutList& list);

	public:
		//input injections
		void ResetInput();
		void OnKeyDown(int key);
		void OnKeyUp(int key);
		void OnMouseLeftDown(int x,int y);
		void OnMouseLeftUp(int x,int y);
		void OnMouseRightDown(int x,int y);
		void OnMouseRightUp(int x,int y);
		void OnMouseMidDown(int x,int y);
		void OnMouseMidUp(int x,int y);
		void OnMouseMove(int x,int y);
	private:
		bool _inputPressed[MOUSE_BUTTON_COUNT+KEY_CODE_COUNT];//

		ShortcutManager* _shortcutMgr;
	};
}

#endif
